package com.example.safeassistan.home.adapter;

import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;
import com.example.safeassistan.risk.model.RiskPointDetailRisk;

import org.w3c.dom.Text;

import java.util.List;

public class RiskDetailRiskFragmentAdapter extends BaseQuickAdapter<RiskPointDetailRisk.ResultDTO.SeDangerRiskListDTO,BaseViewHolder> {
    public RiskDetailRiskFragmentAdapter(@Nullable List<RiskPointDetailRisk.ResultDTO.SeDangerRiskListDTO> data) {
        super(R.layout.item_riskdetail_risk_fragment, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RiskPointDetailRisk.ResultDTO.SeDangerRiskListDTO item) {
        helper.setText(R.id.tvRiskId,item.getRiskCode());
        TextView tvLevel=helper.getView(R.id.tvLevel);

        if (item.getRiskLevel()!=null){
            switch (item.getRiskLevel()){
                case 1:
                    tvLevel.setText("重大");
                    break;
                case 2:
                    tvLevel.setText("较大");
                    break;
                case 3:
                    tvLevel.setText("一般");
                    break;
                case 4:
                    tvLevel.setText("较低");
                    break;
            }
        }

        helper.setText(R.id.tvCheckItem,item.getRiskName());//检查项
        helper.setText(R.id.tvRiskReason,item.getRiskReason());
        helper.setText(R.id.tvRiskResult,item.getRiskConsequence());
    }

}